package vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Schema(description = "响应结果对象")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResponseResult implements Serializable {

    @Schema(description = "响应状态码")
    public String responseCode;

    @Schema(description = "响应消息")
    public String message;

    @Schema(description = "响应数据")
    private Object returnObject;

    public static ResponseResult success(){
        return new ResponseResult("200","OK",null);
    }

    public static ResponseResult success(String message){
        return new ResponseResult("200",message,null);
    }

    public static ResponseResult success(Object returnObject){
        return new ResponseResult("200","OK",returnObject);
    }

    public static ResponseResult success(String message,Object returnObject){
        return new ResponseResult("200",message,returnObject);
    }

    public static ResponseResult fail(String message){
        return new ResponseResult("500",message,null);
    }

    public static ResponseResult fail(Object returnObject){
        return new ResponseResult("500","FAIL",returnObject);
    }

    public static ResponseResult fail(String message,Object returnObject){
        return new ResponseResult("500",message,returnObject);
    }
}
